package com.blockmeta.bbs.businesslibrary.pojo;

import android.os.Parcel;
import android.os.Parcelable;

public class MessageParam implements Parcelable {
    private final int msgType;
    private final long toId;
    private final String content;
    private final String fileUrl;
    private final String fileName;
    private final int fileType;
    private final String fileParam;
    private final int contentType;
    //只在新建假的红包消息的时候用
    private long msgId;

    public MessageParam(int msgType, long toId, String content, String fileUrl, String fileName, int fileType, String fileParam, int contentType, long msgId) {
        this.msgType = msgType;
        this.toId = toId;
        this.content = content;
        this.fileUrl = fileUrl;
        this.fileName = fileName;
        this.fileType = fileType;
        this.fileParam = fileParam;
        this.contentType = contentType;
        this.msgId = msgId;
    }

    public MessageParam(int msgType, long toId, String content, String fileUrl, String fileName, int fileType, String fileParam, int contentType) {
        this.msgType = msgType;
        this.toId = toId;
        this.content = content;
        this.fileUrl = fileUrl;
        this.fileName = fileName;
        this.fileType = fileType;
        this.fileParam = fileParam;
        this.contentType = contentType;
    }

    public MessageParam(int msgType, long toId, String content, int contentType) {
        this.msgType = msgType;
        this.toId = toId;
        this.content = content;
        this.fileUrl = "";
        this.fileName = "";
        this.fileType = 0;
        this.fileParam = "";
        this.contentType = contentType;
    }

    public MessageParam(int msgType, long toId, long msgId, String content, int contentType) {
        this.msgType = msgType;
        this.toId = toId;
        this.content = content;
        this.fileUrl = "";
        this.fileName = "";
        this.fileType = 0;
        this.fileParam = "";
        this.contentType = contentType;
    }

    public MessageParam(int msgType, long toId, String content, int contentType, int subType) {
        this.msgType = msgType;
        this.toId = toId;
        this.content = content;
        this.fileUrl = "";
        this.fileName = "";
        this.fileType = subType;
        this.fileParam = "";
        this.contentType = contentType;
    }

    protected MessageParam(Parcel in) {
        msgType = in.readInt();
        toId = in.readInt();
        content = in.readString();
        fileUrl = in.readString();
        fileName = in.readString();
        fileType = in.readInt();
        fileParam = in.readString();
        contentType = in.readInt();
    }


    public static final Creator<MessageParam> CREATOR = new Creator<MessageParam>() {
        @Override
        public MessageParam createFromParcel(Parcel in) {
            return new MessageParam(in);
        }

        @Override
        public MessageParam[] newArray(int size) {
            return new MessageParam[size];
        }
    };

    public int getMsgType() {
        return msgType;
    }

    public long getToId() {
        return toId;
    }

    public String getContent() {
        return content;
    }

    public String getFileUrl() {
        return fileUrl;
    }

    public String getFileName() {
        return fileName;
    }

    public int getFileType() {
        return fileType;
    }

    public String getFileParam() {
        return fileParam;
    }

    public int getContentType() {
        return contentType;
    }

    public long getMsgId() {
        return msgId;
    }

    public void setMsgId(long msgId) {
        this.msgId = msgId;
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(msgType);
        dest.writeLong(toId);
        dest.writeString(content);
        dest.writeString(fileUrl);
        dest.writeString(fileName);
        dest.writeInt(fileType);
        dest.writeString(fileParam);
        dest.writeInt(contentType);
        dest.writeLong(msgId);
    }
}
